home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
BBS-Archive
/
DiskUtil
/
Misc
/
DiskSpare-3.0.lha
/
DiskSpare3.0
/
Support
/
QuietTD.asm
< prev
next >
Wrap
Assembly Source File
|
1994-11-13
|
3KB
|
207 lines
*** QuietTD 1.0 ***
*** Klaus 4.8.94 ***
incdir "work:coding/asm_include/"
include "devices/trackdisk.i"
push macro
movem.l \1,-(sp)
endm
pull macro
movem.l (sp)+,\1
endm
sync = $4489
dmalen = $2000 ;more than enough
start
move.l 4.w,a6
cmp #36,$14(a6) ;version
blt ende
lea ioreq,a2
l0
lea tdname,a0
moveq #0,d0 ;unit
moveq #0,d1 ;flags
bsr OpenDevice
tst.l d0
bne ende
move.l IO_DEVICE(a2),a3 ;adr.
bsr CloseDevice
move.l -28(a3),jmpadr1+2
move.l -28(a3),jmpadr2+2 ;beginio
move.l 4.w,a6
move.l #patche-patch,d0
moveq #1,d1
jsr -198(a6) ;allocmem
move.l d0,d2
beq.s ende
move.l d0,a1
lea patch,a0
move.l #patche-patch,d0
jsr -624(a6) ;copymem
jsr -132(a6) ;forbid
move.l d2,-28(a3) ;set patch
jsr -138(a6) ;permit
ende
moveq #0,d0
rts
patch
push d0-a6
cmp #CMD_READ,IO_COMMAND(a1)
bne pe
tst.l IO_OFFSET(a1) ;block 0 ?
bne pe
bsr getmem
tst.l d2
beq pe ;out of mem
move.l d2,a5
move.l d2,a0
move.l a1,a4
moveq #IOSTD_SIZE-1,d0
1$
move.b (a1)+,(a0)+ ;copy io-req
dbf d0,1$
move.l a4,a1
move #TD_RAWREAD,IO_COMMAND(a1)
moveq #1,d0 ;quick
bset #IOTDB_WORDSYNC,d0
move.b d0,IO_FLAGS(a1)
move.l #dmalen,IO_LENGTH(a1)
lea IOSTD_SIZE(a5),a0
move.l a0,IO_DATA(a1) ;adr.
move.l IO_DEVICE(a1),a6
jmpadr1
jsr 0.l ;beginio
move.l a4,a1
move.l 4.w,a6
jsr -474(a6) ;waitio
moveq #0,d0
move.b IO_ERROR(a4),d0 ;io_error
cmp.l #TDERR_NoSecHdr,d0
beq.s pme ;disk not formatted or drive error
lea IOSTD_SIZE(a5),a0
move #dmalen/4-1,d0
l1
cmp.l #$4489552A,(a0)+ ;first long in block
beq.s pme ;td track -> let it read
dbf d0,l1
move.l a5,a0
move.l a4,a1
moveq #IOSTD_SIZE-1,d0
1$
move.b (a0)+,(a1)+ ;copy back io-req
dbf d0,1$
bsr freemem
move.b #TDERR_NoSecHdr,IO_ERROR(a4)
2$
pull d0-a6
moveq #0,d0 ;roger
move.b IO_ERROR(a1),d0
ext d0
ext.l d0
rts
pme
move.l a5,a0
move.l a4,a1
moveq #IOSTD_SIZE-1,d0
1$
move.b (a0)+,(a1)+ ;copy back io-req
dbf d0,1$
bsr.s freemem ;ioreq + buffer
pe
pull d0-a6
jmpadr2
jmp 0.l
getmem
push d0-1/a0-1/a6
move.l 4.w,a6
move.l #dmalen+IOSTD_SIZE,d0
move.l #$10002,d1 ;chip + clear
jsr -198(a6) ;allocmem
move.l d0,d2
pull d0-1/a0-1/a6
rts
freemem
push d0-1/a0-1/a6
move.l 4.w,a6
move.l #dmalen+IOSTD_SIZE,d0
move.l a5,a1
jsr -210(a6) ;freemem
pull d0-1/a0-1/a6
rts
patche
*-------
* D0 = Unitnummer
* D1 = Flags
* A0 = Devicename
OpenDevice
push d1-a6
move.l d0,d2
move.l d1,d3
move.l a0,a2
move.l 4.w,a6
sub.l a1,a1
jsr -294(a6) ;findtask
move.l d0,myport+$10
lea myport,a1
move.l d0,$10(a1) ;in port
jsr -354(a6) ;addport
move.l d2,d0 ;unit
move.l d3,d1 ;flags
move.l a2,a0 ;name
lea ioreq,a1 ;ioreq
jsr -444(a6) ;opendevice
tst.l d0
beq.s 1$ ;fehler
move.l d0,d2
lea myport,a1
jsr -360(a6) ;remport
move.l d2,d0
bra.s 2$
1$
lea ioreq,a1
move.l #myport,14(a1) ;port eintragen
2$
pull d1-a6
rts
*-------
CloseDevice
push d0-a6
move.l 4.w,a6
lea ioreq,a1
jsr -450(a6) ;closedevice
lea myport,a1
jsr -360(a6) ;remport
pull d0-a6
rts
cnop 0,4
ioreq ds.l IOSTD_SIZE ;ioreq
myport ds.l 8 ;msgport
dosbase dc.l 0
tdname dc.b "trackdisk.device",0
dosname dc.b "dos.library",0
end